package cn.tedu.micro.demo.order.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

/**
 * 网关案例测试接口
 */
@RestController
@Slf4j
public class HelloController {
    //可以将yaml属性 server.port注入到代码中
    @Value("${server.port}")
    private String port;
    /**
     * GET
     * /order/hello
     * String 返回值
     */
    @GetMapping("/order/hello")
    public String sayHi(@RequestHeader(value = "TOKEN",required = false)String token,
                        @RequestHeader(value = "NAME",required = false)String name){
        return "Hello Gateway,I am order service,I am from "+port+",token="+token+",name="+name;
    }
}
